package service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import qingke.mybatis.dao.UserMapper;
import qingke.mybatis.pojo.User;
import service.UserService;

@Service("UserService")
public class UserServiceImpl implements UserService{

	@Autowired
	private UserMapper usermapper;
	
	public User login(Integer userId) {
		return this.usermapper.login(userId);
	}

	public User register(User user) {
		this.usermapper.register(user);
		user = this.login(user.getId());
		return user;
	}

	public int update(User user) {
		return this.usermapper.updateByPrimaryKeySelective(user);
	}

	public int bemanager(Integer user_id) {
		// TODO Auto-generated method stub
		return 0;
	}

	public User updateUserAccount(Integer user_id, Integer amount) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<User> getAllUser() {
		return this.usermapper.getAllUser();
	}

}
